package utils;

import android.support.v4.app.FragmentActivity;
import android.support.v7.app.AppCompatActivity;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2018/3/31.
 */

public class ActivityControl {
    public static List<FragmentActivity> activities = new ArrayList<FragmentActivity>();

    public static void addActivity(FragmentActivity activity) {
        activities.add(activity);
    }

    public static void removeActivity(FragmentActivity activity) {
        activities.remove(activity);
    }

    public static void finishAll() {
        for (FragmentActivity activity : activities) {
            if (!activity.isFinishing()) {
                activity.finish();
            }
        }
    }
}
